from typing import Any

from aiogram import types
from aiogram_dialog import DialogManager, Window
from aiogram_dialog.widgets.kbd import Back, Button, Cancel, Group

from app.bot.dialog.dialog_states import SelectProxySG
from app.bot.dialog.widgets import LocaleText


async def set_proxy_privacy(
    call: types.CallbackQuery, widget: Any, manager: DialogManager
):
    manager.dialog_data["proxy_privacy"] = widget.widget_id
    await manager.switch_to(
        SelectProxySG.list_of_countries,
    )


proxy_privacy_window = Window(
    LocaleText("select-proxy-privacy"),
    Group(
        Button(LocaleText("private-proxy"), id="private", on_click=set_proxy_privacy),
        Button(LocaleText("shared-proxy"), id="shared", on_click=set_proxy_privacy),
        width=2,
    ),
    Back(LocaleText("back-btn")),
    Cancel(LocaleText("cancel-btn")),
    state=SelectProxySG.select_proxy_privacy,
)
